using System;
using System.Data;

namespace FreeFlow.Client
{
  /// <summary>The type of forms to list</summary>
	public enum FormType 
  {
    /// <summary>Blank forms</summary>
    Blank, 
    /// <summary>Admin forms</summary>
    Admin
  };
	
  /// <summary>A list containing blank forms</summary>
  /// <example>
  /// This shows how to populate an ASP.NET DataGrid from an BlankFormsList object. 
  /// Connection is an already connected <see cref="Connection"/> object.
  /// Populating a WinForms DataGrid is very similar but without a call to DataBind. 
  /// <code language="c#">
  /// BlankFormsList list = new BlankFormsList();
  /// list.Connection = Connection;
  /// list.BlankFormType = FormType.Blank;
  /// list.RefreshItems();
  /// dataGrid.DataSource = list.ListDataTable;
  /// dataGrid.DataBind();
  /// </code>
  /// </example>
	[Serializable]
  public class BlankFormsList : List 
	{
    /// <summary>
    /// Creates a new <see cref="BlankFormsList"/> instance.
    /// </summary>
		public BlankFormsList() : base()
		{
			formType = FormType.Blank;
		}
		
		private FormType formType;
    /// <summary>
    /// Gets or sets the blank form type.
    /// </summary>
		public FormType BlankFormType
		{
			get { return formType; }
			set { formType = value; }
		}
		
    /// <summary>
    /// Returns the type of list to be passed to the engine
    /// </summary>
		protected override string ListType()
		{
			if (formType == FormType.Blank)
				return "Blank";
			else
				return "Admin";
		}

    /// <summary>
    /// Returns the where clause for the engine request for this blank forms list
    /// </summary>
    protected override string RequestData()
    {
      if ((Filter != null) && (Filter.Length > 0))
        return "<Where><![CDATA[ " + Filter + " ]]> </Where>";
      else
        return string.Empty;
    }

    /// <summary>The column that contains the group name for the blank form.</summary>
    public const string GroupColumn = "eGroupName";
    /// <summary>The column that contains the procedure name for the blank form.</summary>
    public const string ProcedureColumn = "eProcedureName";
    /// <summary>The column that contains the process name for the blank form.</summary>
    public const string ProcessColumn = "eMapName";
    /// <summary>The column that contains the action name for the blank form.</summary>
    public const string ActionColumn = "eActionName";
    /// <summary>The column that contains the description for the blank form.</summary>
    public const string DescriptionColumn = "eDescription";
	}
}
